﻿/*
* 创建者：LIYINFAI
* 创建时间：2023/10/24 9:35:26
* 描述：
* --------------------------------------
* 修改说明：
* --------------------------------------
*/
using CommonLibrary;
using System;

namespace BusinessLibrary
{
    /// <summary>
    /// 插件扩充方法类
    /// </summary>
    public static class PluginExtend
    {
        /// <summary>
        /// 信息日志
        /// </summary>
        /// <param name="plugin">主体</param>
        /// <param name="message">消息</param>
        public static void Info(this IPlugin plugin, string message)
        {
            LogHelper.Info($"【{System.Threading.Thread.CurrentThread.ManagedThreadId}】 {plugin.Description} - {message}");
        }
        /// <summary>
        /// 错误日志
        /// </summary>
        /// <param name="plugin">主体</param>
        /// <param name="ex">异常</param>
        public static void Error(this IPlugin plugin, Exception ex)
        {
            LogHelper.Error(ex, "", $"【{System.Threading.Thread.CurrentThread.ManagedThreadId}】 {plugin.Description}");
        }
        /// <summary>
        /// 错误日志
        /// </summary>
        /// <param name="plugin">主体</param>
        /// <param name="message"></param>
        public static void Error(this IPlugin plugin, string message)
        {
            LogHelper.Error(null, "", $"【{System.Threading.Thread.CurrentThread.ManagedThreadId}】 {plugin.Description} {message}");
        }
    }
}
